//
//  ImgTitleItem.m
//  CareRingApp
//
//  Created by Linktop on 2024/4/9.
//

#import "ImgTitleItem.h"
#import <QMUIKit/QMUIKit.h>
#import <Masonry/Masonry.h>
#import "ConfigModel.h"
@implementation ImgTitleItem

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)init
{
    self = [super init];
    if (self) {
        [self baseLayout];
    }
    return self;
}

-(void) baseLayout
{
    [self addSubview:self.imageView];

    [self.imageView mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(self.mas_leading);
        make.top.greaterThanOrEqualTo(self.mas_top);
        make.bottom.lessThanOrEqualTo(self.mas_bottom);
    }];
    
    [self addSubview:self.titleLbl];
    [self.titleLbl mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(self.imageView.mas_trailing).offset(5);
        make.centerY.equalTo(self.imageView.mas_centerY);
        make.top.greaterThanOrEqualTo(self.mas_top);
        make.bottom.lessThanOrEqualTo(self.mas_bottom);
    }];
    
}

-(UIImageView *)imageView
{
    if (!_imageView) {
        _imageView = [UIImageView new];
        _imageView.contentMode = UIViewContentModeScaleAspectFit;
        
    }
    return _imageView;
}

-(UILabel *)titleLbl
{
    if (!_titleLbl)
    {
        _titleLbl = [UILabel new];
        _titleLbl.textAlignment = NSTextAlignmentLeft;
//        _heartRateLbl.font = [UIFont fontWithName:FONT_ARIAL_BOLD size:17];
    }
    return _titleLbl;
}

@end
